import 'package:flutter/material.dart';

class DictHelper {
  static String name(num key, Map<int, Map<String, dynamic>> dict) {
    var isExist = dict.containsKey(key);
    if (isExist == true) {
      var item = dict[key];
      if (item != null) {
        return item['name'] as String;
      }
      return '';
    } else {
      return '';
    }
  }

  static Color color(num key, Map<int, Map<String, dynamic>> dict) {
    var isExist = dict.containsKey(key);
    if (isExist == true) {
      var item = dict[key];
      if (item != null) {
        return item['color'] as Color;
      }
      return Colors.transparent;
    } else {
      return Colors.transparent;
    }
  }

  static Color border(num key, Map<int, Map<String, dynamic>> dict) {
    var isExist = dict.containsKey(key);
    if (isExist == true) {
      var item = dict[key];
      if (item != null) {
        return item['border'] as Color;
      }
      return Colors.transparent;
    } else {
      return Colors.transparent;
    }
  }

  static Color fontColor(num key, Map<int, Map<String, dynamic>> dict) {
    var isExist = dict.containsKey(key);
    if (isExist == true) {
      var item = dict[key];
      if (item != null) {
        return item['fontColor'] as Color;
      }
      return Colors.transparent;
    } else {
      return Colors.transparent;
    }
  }
}
